package com.bwf.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @Version v1.0
 * @Description: TODO
 * @Author ZHANZHONGXIN
 * @Date 2022/6/9 15:25
 * @Copyright 博为峰
 */
@WebServlet(urlPatterns = "/stu")
public class StudentServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        resp.setContentType("text/html;charset=utf8");
//        PrintWriter printWriter = resp.getWriter();
//        printWriter.write("<html lang=\"en\">");
//        printWriter.write("<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"><meta charset=\"UTF-8\"> <title>Title</title></head>");
//        printWriter.write("<body>");
//        printWriter.write("<h1>");
//        printWriter.write("张三");
//        printWriter.write("</h1>");
//        printWriter.write("</body>");
//        printWriter.write("</html>");
//        req.setAttribute("name", "张三");
        req.getRequestDispatcher("/j02.jsp").forward(req, resp);
    }
}
